ADD_EXECUTABLE(main main.c)

##########################
## 关于 引入头文件搜索路径 
##########################

# 1. 直接指定绝对路径
#INCLUDE_DIRECTORIES(/tmp/usr/include/hello)

# 2. 指定头文件 环境变量
#    export C_INCLUDE_PATH=/tmp/usr/include/hello/:$C_INCLUDE_PATH
#    export CPLUS_INCLUDE_PATH=/tmp/usr/include/hello/:$CPLUS_INCLUDE_PATH

# 3. 指定特殊的环境变量  CMAKE_LIBRARY_PATH
#    export CMAKE_INCLUDE_PATH=/tmp/usr/include/hello/:$CMAKE_INCLUDE_PATH
FIND_PATH(myHeader hello.h)
IF(myHeader)
	INCLUDE_DIRECTORIES(${myHeader})
ENDIF(myHeader)


#####################
## 关于 添加共享库 
#####################

# 1. 只在系统库中找
#TARGET_LINK_LIBRARIES(main hello)
#TARGET_LINK_LIBRARIES(main libhello.so)

 
# 2. 直接指定绝对路径
#TARGET_LINK_LIBRARIES(main /tmp/usr/lib/libhello.so)


# 3. 指定系统环境变量  export LD_LIBRARY_PATH=/tmp/usr/lib
#TARGET_LINK_LIBRARIES(main libhello.so)

# 4. 指定特殊的环境变量  CMAKE_LIBRARY_PATH=/tmp/usr/lib
#FIND_LIBRARY(mylib libhello.so)
FIND_LIBRARY(mylib hello)
IF(mylib)
	TARGET_LINK_LIBRARIES(main ${mylib})
ENDIF(mylib)

